process_file() {
    local file_type=${1:?}
    local path=${2:?}
    local template=${3:?}
    local filter=${4:?}
    local theme=${5:?}
    local alt_theme_path=${6:?}
    local output_dir=${7:?}
    local git_branch=${8:?}
    local git_commit_id=${9:?}
    local git_commit_id_short=${10:?}
    local date_stamp=${11:?}


    local output_file=
    output_file=$(get_output_file "$file_type" "$path" "$output_dir")
    local output_mkdir=
    output_mkdir=$(dirname "${output_file}")
    
    local ext_to_replace_with_html=
    ext_to_replace_with_html=$(get_ext_to_replace_with_html "$file_type")
    local extension=
    extension=$(get_file_ext "$path")
    local dir_offset=
    dir_offset=$(get_directory_depth_offset "$path")


    mkdir -p "${output_mkdir}"
    if [[ "$extension" != "" ]] && \
           [[ "$extension" == "$ext_to_replace_with_html" ]]; then
        pandoc \
            -f "${file_type}" \
            -t html \
            "${path}" \
            --template "${template}" \
            --lua-filter="${filter}" \
            --table-of-contents \
            --number-sections \
            --variable "offset:$dir_offset" \
            --variable "gitbranch:$git_branch" \
            --variable "gitcommitid:$git_commit_id" \
            --variable "gitcommitidshort:$git_commit_id_short" \
            --variable "date_stamp:$date_stamp" \
            --variable "theme:$theme" \
            --variable "other-theme:$alt_theme_path" \
            --output "${output_file}"
    else
        cp "${path}" "${output_file}"
    fi
}
